<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>跳转主页面</button>
    <script>
        // 获取元素跳转
        document.querySelector('button').onclick = function(){
            window.location.href = '主页面.html'
        }

        let str = window.location.search.substr(1);
        let arr = str.split('&');
        let obj = {};
        arr.forEach(item => {
            let line = item.split('=');
            obj[line[0]] = line[1];
        })
        console.log(obj);
       
    </script>
</body>
</html>